package ym.ecrm.core.domain.salesManagement;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import ym.ecrm.core.domain.base.BaseEntity;
import ym.ecrm.core.domain.customerManagement.Customer;
import ym.ecrm.core.domain.systemManagement.User;

/**
 * 合同类
 * 
 * @author Princess
 * @version 1.0
 */
@Entity
@Table(name = "t_contract")
public class Contract extends BaseEntity {
	/**
	 * 合同编号
	 */
	private String contractCode;
	/**
	 * 合同名字
	 */
	private String contractName;
	/**
	 * 对应销售机会
	 */
	private String salesOpportunity;
	/**
	 * 合同开始时间
	 */
	private Date startTime;
	/**
	 * 合同终止时间
	 */
	private Date endTime;
	/**
	 * 合同期限
	 */
	private int contractTerm;
	/**
	 * 客户签约人
	 */
	private String customerContractor;
	/**
	 * 客户签约时间
	 */
	private Date customerContractTime;
	/**
	 * 客户开户银行
	 */
	private String customerBank;
	/**
	 * 客户开户银行账号
	 */
	private String customerBankAccount;
	/**
	 * 我方签约人
	 */
	private String contractor;
	/**
	 * 我方签约日期
	 */
	private Date contractTime;
	/**
	 * 我方开户银行
	 */
	private String bank;
	/**
	 * 我方开户银行账号
	 */
	private String BankAccount;
	/**
	 * 付款方式
	 */
	private String payType;
	/**
	 * 合同条款
	 */
	private String contractTerms;
	/**
	 * 状态
	 */
	private String Status;

	/**
	 * 合同审批状态
	 */
	private String approvalStatus;

	/**
	 * 审批意见
	 */
	@OneToMany(targetEntity = ApprovalOpinion.class, mappedBy = "contract")
	private Set<ApprovalOpinion> approvalOpinions = new HashSet<ApprovalOpinion>();

	/**
	 * 客户
	 */
	@ManyToOne
	@JoinColumn(name = "customer_id")
	private Customer customer;

	/**
	 * 合同产品
	 */
	@OneToMany
	private Set<Production> productions = new HashSet<Production>();

	/**
	 * 合同所有人
	 */
	@ManyToOne
	@JoinColumn(name = "user_id")
	private User user;

	public String getContractCode() {
		return contractCode;
	}

	public void setContractCode(String contractCode) {
		this.contractCode = contractCode;
	}

	public String getContractName() {
		return contractName;
	}

	public void setContractName(String contractName) {
		this.contractName = contractName;
	}

	public String getSalesOpportunity() {
		return salesOpportunity;
	}

	public void setSalesOpportunity(String salesOpportunity) {
		this.salesOpportunity = salesOpportunity;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public int getContractTerm() {
		return contractTerm;
	}

	public void setContractTerm(int contractTerm) {
		this.contractTerm = contractTerm;
	}

	public String getCustomerContractor() {
		return customerContractor;
	}

	public void setCustomerContractor(String customerContractor) {
		this.customerContractor = customerContractor;
	}

	public Date getCustomerContractTime() {
		return customerContractTime;
	}

	public void setCustomerContractTime(Date customerContractTime) {
		this.customerContractTime = customerContractTime;
	}

	public String getCustomerBank() {
		return customerBank;
	}

	public void setCustomerBank(String customerBank) {
		this.customerBank = customerBank;
	}

	public String getCustomerBankAccount() {
		return customerBankAccount;
	}

	public void setCustomerBankAccount(String customerBankAccount) {
		this.customerBankAccount = customerBankAccount;
	}

	public String getContractor() {
		return contractor;
	}

	public void setContractor(String contractor) {
		this.contractor = contractor;
	}

	public Date getContractTime() {
		return contractTime;
	}

	public void setContractTime(Date contractTime) {
		this.contractTime = contractTime;
	}

	public String getBank() {
		return bank;
	}

	public void setBank(String bank) {
		this.bank = bank;
	}

	public String getBankAccount() {
		return BankAccount;
	}

	public void setBankAccount(String bankAccount) {
		BankAccount = bankAccount;
	}

	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	public String getContractTerms() {
		return contractTerms;
	}

	public void setContractTerms(String contractTerms) {
		this.contractTerms = contractTerms;
	}

	public String getStatus() {
		return Status;
	}

	public void setStatus(String status) {
		Status = status;
	}

	public String getApprovalStatus() {
		return approvalStatus;
	}

	public void setApprovalStatus(String approvalStatus) {
		this.approvalStatus = approvalStatus;
	}

	public Set<ApprovalOpinion> getApprovalOpinions() {
		return approvalOpinions;
	}

	public void setApprovalOpinions(Set<ApprovalOpinion> approvalOpinions) {
		this.approvalOpinions = approvalOpinions;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Set<Production> getProductions() {
		return productions;
	}

	public void setProductions(Set<Production> productions) {
		this.productions = productions;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}